<?php $this->load->view("common/page_header");?>
<div id="body_main">	
	<div class="login_header">
		<img class="logo" src="/img/logo2.png" />
		<div class="title">创建小组</div>
		<div class="action"><a href="/user/show">行动中心</a></div>
		<div class="clear"></div>
	</div>
	<div class="login_body" style="background:none">
		<div class="arrow_up">
			<em>◆</em>
			<span>◆</span>
		</div>
		<?php echo validation_errors(); ?>
		<form class="margin_top15 margin_left15" method="post" enctype="multipart/form-data" onsubmit="return is_form_valid();">
			<div class="form_row">
				<label class="input_label"><span class="red">* </span>是否公开：</label>
				<input type="radio" class="input_radio" name="is_public" value="0"/> 完全公开
				&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
				<input type="radio" class="input_radio" name="is_public" value="1"/> 验证会员可见
				&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
				<input type="radio" class="input_radio" name="is_public" value="2"/> 仅限内部组员
			</div>
			<div class="form_row">
				<label class="input_label"><span class="red">*</span> 加入方式：</label>
				<input type="radio" class="input_radio" name="join_type" value="0"/> 任何人可加入
				&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
				<input type="radio" class="input_radio" name="join_type" value="1"/> 经批准后可加入
			</div>
			<div class="form_row">
				<label class="input_label"><span class="red">* </span>小组类别：</label>
				<select class="section_selector">
					<option value="">行业类别</option>
					<?php foreach($first_level_categories as $category) {?>
					<option value="<?php echo $category['id']?>"><?php echo $category['name']?></option>	
					<?php }?>
				</select>
				<select name="category_id" id="category_id">
					<option value="">小组分类</option>
				</select> 
			</div>
			<div class="form_row">
				<label class="input_label"><span class="red">* </span>面对地区：</label>
				<?php $this->load->view("common/province_selector");?>
			</div>
			<div class="form_row">
				<label class="input_label"><span class="red">* </span>小组名称：</label>
				<input class="input_text_short" type="text" name="title"/>
			</div>
			<div class="form_row">
				<label class="input_label"><span class="red">* </span>小组介绍：</label>
				<textarea class="input_textarea" name="introduction" id="group_introduction"></textarea>
				<div class="input_hint">100-700字（描述小组成立目的）</div>
				<div class="form_error"><div class="error_icon"></div>小组介绍要在100-700个字内</div>
			</div>
			<div class="form_row">
				<label class="input_label">小组标徽：</label>
				<input type="file" name="userfile"/>
				<span class="grey margin_left15">上传图片建议长高分别160x80像素的jpg/gif/bmp/png格式图片</span>
				
			</div>
			<div class="form_action">
				<input type="checkbox" /> 同意<a href="###">《小组创建规则》</a>
				<input type="submit" value="提交注册" class="input_button margin_left15"/>
			</div>
			
		</form>
		<div class="clear"></div>
	</div>
</div>
<?php $this->load->view("common/footer");?>		
<?php $this->load->view("common/page_footer");?>
<script type="text/javascript">
function is_form_valid() {
	var has_error = false;

	var group_introduction = $('#group_introduction');
	var introduction = group_introduction.val();
	if (introduction.length < 100 || introduction.length > 700) {
		has_error = true;
		group_introduction.parent().find('.form_error').show();
	} else {
		group_introduction.parent().find('.form_error').hide();
	}

	return !has_error;
}
$(document).ready(function(){
	$("#register_button").colorbox({iframe:true, innerWidth:556, innerHeight:320, close:'关闭'});
	$("#login_button").colorbox({iframe:true, innerWidth:390, innerHeight:180, close:'关闭'});
});	
</script>